<%@page import="multiface.awwadco.jpa.Utente"%>
<%
    Utente ut = (Utente) session.getAttribute("admin");
    if (ut == null) {
        response.sendRedirect(multiface.web.util.ServletUtils.getBaseUrl(request) + "/admin/index.jsp?err=y");
    }

    String style = "border:2px #ccc solid";
    String all = request.getParameter("all");

    String promo = "";
    String not_promo = "";

    String home = "";
    String not_home = "";

    String visible = "";
    String not_visible = "";

    String sold = "";
    String not_sold = "";


    if (all != null) {
        if (all.equals("promo")) {
            promo = style;
        }
        if (all.equals("not-promo")) {
            not_promo = style;
        }

        if (all.equals("home")) {
            home = style;
        }
        if (all.equals("not-home")) {
            not_home = style;
        }

        if (all.equals("visible")) {
            visible = style;
        }
        if (all.equals("not-visible")) {
            not_visible = style;
        }


        if (all.equals("sold")) {
            sold = style;
        }
        if (all.equals("not-sold")) {
            not_sold = style;
        }
    }
%>
<style>
    .shortcut{
        padding-top:12px;
    }
</style>
<script>
    function open2(allV){
        $("#"+allV).css("border", "1px #ccc solid");
        open('list_prod.jsp',{all:allV});
    }
</script>

<div class="title">Commands</div>
<ul>
    <li id="new_prod"><a href="javascript:open('add_prod.jsp')">New Product</a></li>
</ul>
<div class="title">Search Product</div>
<ul>
    <label for="search">Code or Name</label>
    <input class="input-search" name="search" id="search" type="text" value="<%=request.getParameter("text") != null ? request.getParameter("text") : ""%>"/>
</ul>
<ul>
    <div style="margin-left:2px; margin-bottom:6px;font-variant: small-caps;">Shortcut</div>
    <div class="shortcut">
        <a href="javascript:open2('promo');"><img style="<%=promo%>" title="Promo" height="16" width="16" src="../engine/img/promo.png" alt="All promo products"></a>
        <a href="javascript:open2('home');"><img style="<%=home%>" title="Home" height="16" width="16" src="../engine/img/home.png" alt="All home products"></a>
        <a href="javascript:open2('visible');"><img style="<%=visible%>" title="Visible" height="16" width="16" src="../engine/img/visibile.png" alt="All visible products"></a>
        <a href="javascript:open2('sold');"><img style="<%=sold%>" title="Sold" height="16" width="16" src="../engine/img/sold_icon_yes.png" alt="All sold products"></a>
    </div>
    <div class="shortcut">
        <a href="javascript:open2('not-promo');"><img style="<%=not_promo%>" title="Promo" height="16" width="16" src="../engine/img/notpromo.png" alt="All promo products"></a>
        <a href="javascript:open2('not-home');"><img style="<%=not_home%>" title="Home" height="16" width="16" src="../engine/img/nothome.png" alt="All home products"></a>
        <a href="javascript:open2('not-visible');"><img style="<%=not_visible%>" title="Visible" height="16" width="16" src="../engine/img/unvisibile.png" alt="All visible products"></a>
        <a href="javascript:open2('not-sold');"><img style="<%=not_sold%>" title="Sold" height="16" width="16" src="../engine/img/sold_icon_no.png" alt="All sold products"></a>
    </div>
</ul>

<script>
    $("#search").keyup(function () {
        search('list_prod.jsp',{},'center');
    });
</script>
